package com.recipe.mq;

import com.alibaba.fastjson.JSON;
import com.recipe.entity.DishCollect;
import com.recipe.service.DishCollectService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author lzk
 * @date 2024-06-18 14:46:41
 * @description
 */
@Component
@RocketMQMessageListener(topic = "dish-collect",consumerGroup = "dish-collect-consumer")
@Slf4j
public class dishConsumer implements RocketMQListener<String> {

    @Resource
    DishCollectService dishCollectService;

    @Override
    public void onMessage(String s) {
        DishCollect dishCollect = JSON.parseObject(s, DishCollect.class);

        dishCollectService.synLikedByMessage(dishCollect);




    }
}
